import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate'

// 创建 pinia 实例
const pinia = createPinia()

// 添加持久化插件
pinia.use(
  createPersistedState({
    storage: localStorage,
    serializer: {
      serialize: JSON.stringify,
      deserialize: JSON.parse
    }
  })
)

export default pinia

// 导出所有 store
export { useUserStore } from './user'
export { useAppStore } from './app'
export { useCourseStore } from './course'
export { useExamStore } from './exam'
export { useThemeStore } from './theme'